#include <bits/stdc++.h>

using namespace std;

int main(int argc, char const *argv[])
{
	int t;scanf("%d", &t);
	int cnt=0;
	while(cnt++<t){
		int n;scanf("%d", &n);
		int a[n];
		for (int i = 0; i < n; ++i)
		{
			scanf("%d", &a[i]);
		}
		unordered_map<int,int>mp;
		int ans=0;
		for (int i = 0; i < n; ++i)
		{
			for (int j = i+1; j < n; ++j)
			{
				int num=a[j]-a[i];
				if(mp[num]==0){
					++ans;
					mp[num]=1;
				}
			}
		}
		printf("%d\n", ans);
	}
	return 0;
}
